const fs = require('fs');
const time = require('../../utils/time')


exports.feedback = (req, res) => {
    const { message, call } = req.body
    if (message.length === 0) return res.send({
        status: 1,
        message: '请输入要反馈的信息'
    })

    const data = `

    反馈信息：${message}
    联系方式：${call}
    时间：${time(Date.now())[0]}${time(Date.now())[1]}`
    fs.appendFile('feed.txt', data, (err) => {
        if (err) return res.send({
            status: 1,
            message: '反馈失败'
        })
        res.send({
            status: 0,
            message: '反馈成功'
        })
    })
}